<?php

namespace App\Http\Middleware\Rong360;

use App\Library\Guzzle\Sign;
use Closure;

class CheckData
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $sign = $request->sign;
        $data = $request->biz_data;
        $flag = Sign::verifyForServer($data, $sign);
        if($flag){
            return $next($request);
        }
        return r360fail([],'签名数据失败！');
    }
}
